#pragma once
#ifndef __G_CRITICAL_SECTION_H__
#define __G_CRITICAL_SECTION_H__

#include "GTypes.h"

namespace GThread
{

	class GCriticalSection
	{
	friend class GConditionVar;

	protected:
		void*		Section;
		GUInt32		SpinCount;

	public:
					GCriticalSection();
					~GCriticalSection();

		GUInt32		GetSpinCount() const;
	
		bool		IsCreated() const;

		bool		Create(GUInt32 TheSpinCount);
		void		Release();

		bool		Leave();

		bool		Enter();
		bool		TryEnter();
	
	};
}

#endif